@using k8s.Models
@using Microsoft.IdentityModel.Tokens
@using BlazorApp.Pages.Common.Html.HTable
@using BlazorApp.Pages.Common.Html
@inherits BlazorApp.Pages.Common.PageBase

@if (Item != null)
{
    <HTable Bordered Column="1">
        @if (Item.Name != null)
        {
            <HTableColumn Title=@L["Name"] ExplainField=@(ExplainFieldPrefix + ".metadata.name")>
                <Text Copyable>@Item.Name</Text>
            </HTableColumn>
        }
        @if (Item.CreationTimestamp != null)
        {
            <HTableColumn Title=@L["Creation"] ExplainField=@(ExplainFieldPrefix + ".metadata.creationTimestamp")>
                <AgeView Age="@Item.CreationTimestamp"></AgeView>
                (@Item.CreationTimestamp.GetValueOrDefault().ToLocalTime())
            </HTableColumn>
        }

        @if (!Item.Namespace().IsNullOrEmpty())
        {
            <HTableColumn Title=@L["Namespace"] ExplainField=@(ExplainFieldPrefix + ".metadata.namespace")>
                <RefView FullView="true" Ref="@NsRef(Item.Namespace())"></RefView>
            </HTableColumn>
        }
        <LabelsView Labels="Item.Labels" ExplainField=@(ExplainFieldPrefix + ".metadata.labels")></LabelsView>
        <AnnotationsView Annotations="@Item.Annotations" ExplainField=@(ExplainFieldPrefix + ".metadata.annotations")></AnnotationsView>
        <ControllerByView Owner=@Item.OwnerReferences Namespace=@Item.NamespaceProperty ExplainField=@(ExplainFieldPrefix + ".metadata.ownerReferences")></ControllerByView>
        <FinalizersView Finalizers="@Item.Finalizers" ExplainField=@(ExplainFieldPrefix + ".metadata.finalizers")></FinalizersView>
        <ManagedFieldsView ManagedFields="@Item.ManagedFields" ExplainField=@(ExplainFieldPrefix + ".metadata.managedFields")></ManagedFieldsView>
        <PropertySimpleView Title=@L["DeletionGracePeriodSeconds"] Item="@Item.DeletionGracePeriodSeconds" ExplainField=@(ExplainFieldPrefix + ".metadata.deletionGracePeriodSeconds")></PropertySimpleView>
        <PropertySimpleView Title=@L["DeletionTimestamp"] Item="@Item.DeletionTimestamp" ExplainField=@(ExplainFieldPrefix + ".metadata.deletionTimestamp")></PropertySimpleView>
        <PropertySimpleView Title=@L["GenerateName"] Item="@Item.GenerateName" ExplainField=@(ExplainFieldPrefix + ".metadata.generateName")></PropertySimpleView>
        <PropertySimpleView Title=@L["Generation"] Item="@Item.Generation" ExplainField=@(ExplainFieldPrefix + ".metadata.generation")></PropertySimpleView>
        <PropertySimpleView Title=@L["ResourceVersion"] Item="@Item.ResourceVersion" ExplainField=@(ExplainFieldPrefix + ".metadata.resourceVersion")></PropertySimpleView>
        <PropertySimpleView Title=@L["SelfLink"] Item="@Item.SelfLink" ExplainField=@(ExplainFieldPrefix + ".metadata.selfLink")></PropertySimpleView>
        <PropertySimpleView Title=@L["Uid"] Item="@Item.Uid" ExplainField=@(ExplainFieldPrefix + ".metadata.uid")></PropertySimpleView>
    </HTable>
}
